function payAmount(employee) {
    let result;
    if (employee.isSeparated) {
        result = { amount: 0, reasonCode: "SEP" };
    } else {
        if (employee.isRetired) {
            result = { amount: 0, reasonCode: "RET" };
        } else {
            // logic to compute amount
            result = someFinalComputation();
        }
    }
    return result;
}

/****************************************************************** */
function payAmount(employee) {
    if (employee.isSeparated) {
        return { amount: 0, reasonCode: "SEP" };
    }
    // 如果没有 return，就证明是 if 的 else
    if (employee.isRetired) {
        return { amount: 0, reasonCode: "RET" };
    }
    return someFinalComputation();
}